﻿import QtQuick 2.0
import "../components"

Item {
    property var spe;
    property int times;
    anchors.fill: parent
    Connections{  // qmlre
        target: MACO
        onXzbsread:{
            tab.setData(tab.selectedRow,tab.selectedCol,bsval)
        }
    }
    Row{
        x: parent.width - 530*dp
        spacing: 15*dp
        PushButton{
            title: "读取"
            defaultMode1: true
            onReleased: {
                MACO.xzr(tab.selectedRow,tab.selectedCol)
            }
        }
        PushButton{
            title: "写入"
            defaultMode1: true
            onReleased: {
                MACO.xzw(tab.selectedRow,tab.selectedCol,tab.getData())
            }
        }
        PushButton{
            title: "运动"
            defaultMode1: true
            onReleased: {
                MACO.xzy(tab.selectedRow,tab.selectedCol)
            }
        }
        PushButton{
            title: "复位"
            defaultMode1: true
            onReleased: {
                MACO.xzf()
            }
        }
    }

    GridTable{
        id : tab
        y: 60*dp
        title: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
        title2: ["位置", "A", "B", "C", "D", "E", "F", "G", "H"]
        columnCount: 12
        rowCount: 8
    }

    Rectangle{      // 分割线
        width: parent.width
        height: 1
        y: 540*dp
        color: "#EEEEEE"
    }
    Row{
        y: 560*dp
        spacing: 15*dp
        CustomComboBox{
            title: "速度"
            model: ["高", "中", "低"]
            textWidth: 35*dp
            editWidth: 120*dp
            onCurrentText: {
                spe=text;
            }
        }
        LineEditor{
            title: "次数"
            textWidth: 35*dp
            editWidth: 120*dp
            intflag: true
            onTextChanged: {
                var inputValue = parseInt(getText());
                if (!isNaN(inputValue)) {
                    times = inputValue;
                }
            }
        }
        PushButton{
            title: "润脂测试"
            defaultMode1: true
            onReleased: {
                MACO.xzrte(spe,times)
            }
        }
        PushButton{
            title: "停止润脂"
            defaultMode2: true
            onReleased: {
                MACO.xzrst();
            }
        }
    }


}
